package lsj;

import java.util.*;

public class test {

    public static void main(String[] args) {
        Integer seedArray[][]={
                {9,7,8,3,1,2,6,4,5},
                {3,1,2,6,4,5,9,7,8},
                {6,4,5,9,7,8,3,1,2},
                {7,8,9,1,2,3,4,5,6},
                {1,2,3,4,5,6,7,8,9},
                {4,5,6,7,8,9,1,2,3},
                {8,9,7,2,3,1,5,6,4},
                {2,3,1,5,6,4,8,9,7},
                {5,6,4,8,9,7,2,3,1}
        };
        Integer seedArray2[][]={
                {0,0,5,3,0,0,0,0,0},
                {8,0,0,0,0,0,0,2,0},
                {0,7,0,0,1,0,5,0,0},
                {4,0,0,0,0,5,3,0,0},
                {0,1,0,0,7,0,0,0,6},
                {0,0,3,2,0,0,0,8,0},
                {0,6,0,5,0,0,0,0,9},
                {0,0,4,0,0,0,0,3,0},
                {0,0,0,0,0,9,7,0,0}
        };
        int success=0,fail=0,num=10;
        System.out.println("开始");
        long startTime=System.currentTimeMillis();   //获取开始时间
        ShuDu shuDu = new ShuDu();
        try {
//            for(int i=0;i<num;i++) {
//                //随机数独模板生成
//                if(shuDu.CheckShuDu(shuDu.getShuDuByDiagonal())){
//                    success++;
//                    System.out.println(success+"     ++++++++++++++++++++++++++++++++++++++");
//                    shuDu.printShuDu();
//                }else{
//                    fail++;
//                }
//            }

            int n = shuDu.getAnswerNumber(seedArray2);
            System.out.println("有"+n+"个解");

        } catch (Exception e) {
            e.printStackTrace();
        }
        long endTime=System.currentTimeMillis(); //获取结束时间
        System.out.println("成功："+success);
        System.out.println("失败："+fail);
        System.out.println("生成"+num+"个数独花费时间:"+(endTime-startTime)/1000f+" 秒\\"+(endTime-startTime)+"ms");


    }

}
